package com.leigang.boot.controller;

import com.leigang.boot.service.UserService;
import com.leigang.boot.entity.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class UserController {
    @Resource
    private UserService userService;

    @RequestMapping("/save")
    public String save(User user){
        userService.save(user);
        return "保存成功";
    }


    @RequestMapping("/findAll")
    public List findAll(){
       return userService.findAll();
    }


    @RequestMapping("/deleteById")
    public String delete(Integer id){
        userService.delete(id);
        return "删除成功";
    }

}
